let $INS
let getStation = () => {
  return window.parent.document.getElementById('src').value
}
let $REAL_FLAG = true
let $STATION = getStation()
window.addEventListener('message', function (e) {
  console.log('[receive message]', e.data)
  $STATION = e.data
  $REAL_FLAG ? realtime() : history()

});

class Task {
  REG_TASK = /\/(?<s>.+?)\/(?<day>(?<y>20\d{2})(?<m>\d{2})(?<d>\d{2}))/

  constructor(ss) {
    Object.assign(this, this.REG_TASK.exec(ss).groups)
    let s = ss.split('/')
    this.task = ss
    this.label = `${s[s.length - 2]} / ${s[s.length - 3]}`
  }

  date() {
    return `${this.y}-${this.m}-${this.d}`;
  }

  option() {
    return `<option value="${this.task}">${this.label}</option>`
  }
}
